home *** CD-ROM | disk | FTP | other *** search
/ Aminet 32 / Aminet 32 (1999)(Schatztruhe)[!][Aug 1999].iso / Aminet / dev / lang / Python152_Src.lha / Python152_Source / Amiga_Misc / mkdiffs.py < prev    next >
Text File  |  1998-09-30  |  1KB  |  56 lines

  1. #
  2. # This script will check each source directory, and output the differences
  3. # with the original distribution into a DIFF file.
  4. #
  5. # Uses dirdiff (by me) and diff (from SAS)
  6. #
  7. # Assign python_dist: to the location of the original sources.
  8. # Then cd to the root of the Amiga source tree and type
  9. #   'python Amiga_Misc/mkdiffs.py'
  10. #
  11. #         15-Apr-96,  Irmen de Jong.
  12. #
  13.  
  14. import os
  15. import string
  16. import sys
  17.  
  18. def_orig='python_dist:'
  19. def_dest='Amiga_Misc/diffs/'
  20.  
  21. def dodir(dir,orig=def_orig,dest=def_dest):
  22.     outfile=dest+'DIFFS_'+dir
  23.     print "processing",dir,"-->",outfile
  24.     dd=os.popen('dirdiff '+dir+' '+orig+dir+' short u d').readlines()
  25.  
  26.     out=open(outfile,'w')
  27.  
  28.     dd.sort()
  29.     dd.reverse()
  30.  
  31.     for line in dd:
  32.         d=string.split(line)
  33.         if d[1][-2:]=='.o': continue        # skip object files
  34.         if d[0]=='UNQ1:':
  35.             # unique for current path, ADDED
  36.             out.write('ADDED   : '+d[1]+'\n')
  37.         elif d[0]=='UNQ2:':
  38.             # unique for original path, REMOVED
  39.             out.write('REMOVED : '+d[1]+'\n')
  40.         elif d[0]=='DIF1:':
  41.             # difference in files.
  42.             # Use pipe to get output from diff.
  43.             print '   diff ',d[1]
  44.             p=os.popen("diff -l6000 %s/%s %s/%s" % (dir,d[1],orig+dir,d[1]))
  45.             out.writelines(p.readlines())
  46.     out.close()
  47.  
  48.  
  49. def run(list):
  50.     print "GENERATING DIFF FILES IN",def_dest
  51.     print "PATH OF ORIGINAL PYTHON DISTRIBUTION IS",def_orig
  52.     for d in list: dodir(d)
  53.  
  54. if __name__=='__main__':
  55.     run(['Include','Modules','Objects','Parser','Python'])
  56.